package com.sykj.controller;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sykj.bean.BisProject;
import com.sykj.bean.bis.BisNurseBag;
import com.sykj.bean.bis.BisNurseType;
import com.sykj.service.BisNurseTypeService;
import com.sykj.service.BisProjeectService;
import com.sykj.util.reponse.CommonEnum;
import com.sykj.util.reponse.ResultBody;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @program: BeautyClub
 * @description: 美颜项目信息接口
 * @author: qiaoli
 * @create: 2020-07-29 10:18
 */
@RestController
@RequestMapping("/bisnursetype")
public class BisNurseTypeController {
    @Autowired
    BisNurseTypeService bisNurseTypeService;
    @Autowired
    BisProjeectService bisProjeectService;
@RequestMapping("/queryType")
    public ResultBody queryType(){
        List<BisNurseType> list = bisNurseTypeService.list();
        if(list!=null){
            return  new ResultBody(CommonEnum.WeChat_QUERY_SUCCESS,list);
        }
       return  new ResultBody(CommonEnum.WeChat_QUERY_ERROR);

    }
    /**
     * 功能描述: 分页查询
     * @Param: []
     * @Return: com.sykj.util.reponse.ResultBody
     * @Author: Feiwo Sicun
     * @Date: 2020/8/12 11:11
     */
    @RequestMapping("/queryAll/{curpage}/{limit}")
    public ResultBody queryAll(@PathVariable int curpage, @PathVariable int limit){
        if (curpage > 0 && limit > 0){
            PageHelper.startPage(curpage,limit);
        }
        List<BisProject> bisProjects = bisProjeectService.queryAll();
        if(bisProjects!=null){
            PageInfo<BisNurseBag> pageInfo=new PageInfo(bisProjects);
            return new ResultBody(CommonEnum.WeChat_QUERY_SUCCESS,pageInfo);

        }
        return  new ResultBody(CommonEnum.WeChat_QUERY_ERROR);
    }
}
